<%@ page pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html >
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>

	<h1>Đây là trang ${currentPage}</h1>
	<table border="1">
		<tr>
			<td>ID</td>
		</tr>
	<c:forEach var="p" items="${list}">
			<tr>
				<td>${p.getImage()}</td>
			</tr>
		</c:forEach>
	
	</table>
	
	
	<!-- Tham so vao currentPage / noOfPages -->
	 <c:if test="${currentPage != 1}">
        <td><a href="phantrang.do?page=${currentPage - 1}">Previous</a></td>
    </c:if>
 
    <%--For displaying Page numbers.
    The when condition does not display a link for the current page--%>
    <table border="0" cellpadding="1" cellspacing="1">
        <tr>
            <c:forEach begin="1" end="${noOfPages}" var="i">
                <c:choose>
                    <c:when test="${currentPage eq i}">
                        <td>${i}</td> <!-- Trang hien tai thi ko can href -->
                    </c:when>
                    <c:otherwise>
                        <td><a href="phantrang.do?page=${i}">${i}</a></td>
                    </c:otherwise>
                </c:choose>
            </c:forEach>
        </tr>
    </table>
     
    <%--For displaying Next link --%>
    <c:if test="${currentPage lt noOfPages}">
        <td><a href="phantrang.do?page=${currentPage + 1}">Next</a></td>
    </c:if>
</body>
</html>